package cn.com.w.bootlog.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class SystemOutTest {

    private static Logger log = LoggerFactory.getLogger(SystemOutTest.class);

    public static void main(String[] args) {
        Long startTime1 = System.currentTimeMillis();
        for (int i = 0; i < 1000000; i++) {
            System.out.println("i=" + i);
        }
        Long endTime1 = System.currentTimeMillis();
        System.out.println("使用 System.out 输出, 耗时=" + (endTime1 - startTime1));

//        Long startTime2 = System.currentTimeMillis();
//        for (int i = 0; i < 1000000; i++) {
//            //System.out.println("i=" + i);
//        }
//        Long endTime2 = System.currentTimeMillis();
//        System.out.println("不使用 System.out 输出, 耗时=" + (endTime2 - startTime2));

        Long startTime3 = System.currentTimeMillis();
        for (int i = 0; i < 1000000; i++) {
            log.info("i={}", i);
        }
        Long endTime3 = System.currentTimeMillis();
        System.out.println("使用 log 输出, 耗时=" + (endTime3 - startTime3));
    }
}
